package com.zhangpengkai.service.impl;

import com.zhangpengkai.mapper.RoleMapper;
import com.zhangpengkai.service.RoleService;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RoleServiceImpl implements RoleService {

    private SqlSessionTemplate sqlSessionTemplate;

    @Autowired
    public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
        this.sqlSessionTemplate = sqlSessionTemplate;
    }

    @Override
    public Integer selectRoleById(Integer userId) {

        RoleMapper mapper = sqlSessionTemplate.getMapper(RoleMapper.class);

        Integer roleId = mapper.selectRoleById(userId);

        if(roleId == null){
            System.out.println("没有权限");
        }


        return roleId;
    }
}
